import pandas as pd

# 加载数据集
df = pd.read_csv('titanic.csv')

# 根据条件过滤
rose = df[(df['Sex'] == 'female') & (df['Pclass'] == 1)]
jack = df[(df['Sex'] == 'male') & (df['Pclass'] != 1)]

print("Rose：")
print(rose[['Name', 'Age', 'Sex', 'Pclass']])
print("\nJack：")
print(jack[['Name', 'Age', 'Sex', 'Pclass']])
